package cn.itcast.bos.service.base.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.itcast.bos.dao.base.CourierRepository;
import cn.itcast.bos.domain.base.Courier;
import cn.itcast.bos.domain.base.Standard;
import cn.itcast.bos.service.base.ICourierService;

@Transactional
@Service
public class CourierServiceImpl implements ICourierService {

	@Autowired
	private CourierRepository courierRepository;

	//添加数据
	@Override
	public void save(Courier courier) {
		courierRepository.save(courier);
	}

	//分页查询
	@Override
	public Page<Courier> findPageDate(Specification<Courier> specification,
			Pageable pageable) {
		
		return courierRepository.findAll(specification,pageable);
	}
	
	//作废数据
	@Override
	public void delBatch(String[] idArray) {
		
		for (String id : idArray) {
			Integer idstr=Integer.parseInt(id);
			courierRepository.updateBatch(idstr);
		}
	}

}
